<!DOCTYPE html>
<html class="x-admin-sm">
  
  <head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.1</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <script type="text/javascript" src="./js/cookie.js"></script>
  </head>
  <body>
    <div class="x-body">
        <form class="layui-form">
          <div class="layui-form-item">
              <label for="L_email" class="layui-form-label">
                  <span class="x-red">*</span>提现单号:
              </label>
              <div class="layui-input-inline">
                  <p id="tDdcode" name="tDdcode" required="" 
                  autocomplete="off" class="layui-input"></p>
               
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_username" class="layui-form-label">
                  <span class="x-red">*</span>提现人:
              </label>
              <div class="layui-input-inline">
                  <p id="tUCount" name="tUCount" required="" 
                  autocomplete="off" class="layui-input"></p>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_pass" class="layui-form-label">
                  <span class="x-red">*</span>美金:
              </label>
              <div class="layui-input-inline">
                  <p id="tMeijin" name="tMeijin" required="" 
                  autocomplete="off" class="layui-input"></p>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
                  <span class="x-red">*</span>提现时间:
              </label>
              <div class="layui-input-inline">
                  <p id="tTime" name="tTime" required="" 
                  autocomplete="off" class="layui-input"></p>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
                  <span class="x-red">*</span>转账金额:
              </label>
              <div class="layui-input-inline">
                  <p id="tSdmeijin" name="tSdmeijin" required="" 
                  autocomplete="off" class="layui-input"></p>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
                  <span class="x-red">*</span>提现方式:
              </label>
              <div class="layui-input-inline">
                  <p id="tFangshi" name="tFangshi" required="" 
                  autocomplete="off" class="layui-input"></p>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <button  class="layui-btn" lay-filter="add" lay-submit="" id="pass">
                  通过
              </button>
          </div>
      </form>
    </div>
    <script>
      layui.use(['form','layer'], function(){
          $ = layui.jquery;
        var form = layui.form
        ,layer = layui.layer;
      
        //自定义验证规则
        form.verify({
          nikename: function(value){
            if(value.length < 5){
              return '昵称至少得5个字符啊';
            }
          }
          ,pass: [/(.+){6,12}$/, '密码必须6到12位']
          ,repass: function(value){
              if($('#L_pass').val()!=$('#L_repass').val()){
                  return '两次密码不一致';
              }
          }
        });

        //监听提交
        form.on('submit(add)', function(data){
          console.log(data);
          //发异步，把数据提交给php
          layer.alert("增加成功", {icon: 6},function () {
              // 获得frame索引
              var index = parent.layer.getFrameIndex(window.name);
              //关闭当前frame
              parent.layer.close(index);
          });
          return false;
        });
        
        
      });
      
      $(function(){
    	  var url = window.location;
    	  var id = getUrlParam(url,"id");
    	  get_all_info(id);
      });
      
      //获取数据展示数据
      function get_all_info(id){
    	  var adminUser = localStorage.getItem("adminUser");
    	  adminUser = JSON.parse(adminUser);
    	  if(adminUser ==null){
    		  parent.location.href='login.html';
    		  return false;
    	  }
    	//  console.log("用户："+adminUser); 
    	  $.ajax({
    		  url:"/meiyou/tixian/selectById",
    		  type:"POST",
    		  data:"id="+id,
    		  headers: {
    		        Accept:"application/json; charset=utf-8",
    		        headerId:adminUser.aId,
    		        headerToken:adminUser.token
    		  },
    		  success:function(data){
    			  console.log(data);
    			  $('#tDdcode').html(data.extend.tixian.tDdcode);
    			  $('#tUCount').html(data.extend.tixian.tUCount);
    			  $('#tMeijin').html(data.extend.tixian.tMeijin);
    			  $('#tTime').html(data.extend.tixian.tTime);
    			  $('#tSdmeijin').html(data.extend.tixian.tSdmeijin);
    			  $('#tFangshi').html(data.extend.tixian.tFangshi);
    		  }
    	  });
      }
      
      $('#pass').click(function(){
    	  //修改
    	  var url = window.location;
    	  var id = getUrlParam(url,"id");
    	  var adminUser = localStorage.getItem("adminUser");
    	  adminUser = JSON.parse(adminUser);
    	  if(adminUser ==null){
    		  parent.location.href='login.html';
    		  return false;
    	  }
    	  var tDdcode = $('#tDdcode').html();   //订单号 
    	  var meijin = $('#tMeijin').html();    //提现美金 
    	  var tucount = $('#tUCount').html();     //提现人 
    	  // alert(meijin+"||"+tucount);
    	  $.ajax({
    		  url:"/meiyou/tixian/shenghetixian",
    		  type:"POST",
    		  data:"tUCount="+tDdcode+"&tMeijin="+meijin+"&phone="+tucount,
    		  headers: {
  		        Accept:"application/json; charset=utf-8",
  		        headerId:adminUser.aId,
  		        headerToken:adminUser.token
  		      },
    		  success:function(result){
    			  console.log(result);
    			  
    		  }
    	  });
      });
      
      /***
       ** 获取url地址上参数
       */
     function getUrlParam(url,name){
        var pattern = new RegExp("[?&]" + name +"\=([^&]+)","g");
        var matcher = pattern.exec(url);
        var items = null;
        if(matcher != null){
            try{
                items = decodeURIComponent(decodeURIComponent(matcher[1]));   
            }catch(e){
                try{
                    items = decodeURIComponent(matcher[1]);
                }catch(e){
                    items = matcher[1];
                }
            }
        }
        return items;
     }
      
  </script>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();</script>
  </body>

</html>